<h2><?php pc_echo(pc_message("order.addInfo.title")); ?></h2>
<?php pc_pagelet("common/errors"); 
$errors = pc_variable("errors"); ?>
<form method="post" action="dispatcher.php">
    <fieldset class="distinct">
        <legend><?php pc_echo(pc_message("order.billing")); ?></legend>
        <span class="required">
            <label for="order.billingName"><?php pc_echo(pc_message("field.name")); ?></label>
            <input type="text" id="order.billingName" name="billingName" value="<?php pc_echo(pc_variable("billingName")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "billingName")); ?>
        <span class="required">
            <label for="order.billingAddress.line1"><?php pc_echo(pc_message("field.address.line1")); ?></label>
            <input type="text" id="order.billingAddress.line1" name="billingAddress.line1" value="<?php pc_echo(pc_variable("billingAddress.line1")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "billingAddress.line1")); ?>
        <label for="order.billingAddress.line2"><?php pc_echo(pc_message("field.address.line2")); ?></label>
        <input type="text" id="order.billingAddress.line2" name="billingAddress.line2" value="<?php pc_echo(pc_variable("billingAddress.line2")); ?>"/>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "billingAddress.line2")); ?>
        <span class="required">
            <label for="order.billingAddress.postalCode"><?php pc_echo(pc_message("field.address.postalCode")); ?></label>
            <input type="text" id="order.billingAddress.postalCode" name="billingAddress.postalCode" value="<?php pc_echo(pc_variable("billingAddress.postalCode")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "billingAddress.postalCode")); ?>
        <span class="required">
            <label for="order.billingAddress.city"><?php pc_echo(pc_message("field.address.city")); ?></label>
            <input type="text" id="order.billingAddress.city" name="billingAddress.city" value="<?php pc_echo(pc_variable("billingAddress.city")); ?>"/>
        </span>
        <span class="required">
            <label for="order.billingEmailAddress"><?php pc_echo(pc_message("field.emailAddress")); ?></label>
            <input type="text" id="order.billingEmailAddress" name="billingEmailAddress" value="<?php pc_echo(pc_variable("billingEmailAddress")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "billingEmailAddress")); ?>
        <span>
            <label for="order.vatCode"><?php pc_echo(pc_message("field.vatCode")); ?></label>
            <input type="text" id="order.vatCode" name="vatCode" value="<?php pc_echo(pc_variable("vatCode")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "vatCode")); ?>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "billingAddress.city"));
            $paymentMethod = pc_variable("paymentMethod");
        ?>
        <span class="required">
            <label for="order.paymentMethod"><?php pc_echo(pc_message("field.paymentMethod")); ?></label>
            <select id="order.paymentMethod" name="paymentMethod">
                <option value=""></option>
                <option value="CASH" <?php if($paymentMethod == Pageley_Commerce_Domain_PaymentMethod::$CASH) { ?>selected="selected"<?php }?>><?php pc_echo(pc_message("order.paymentMethod.cash")) ?></option>
                <option value="TRANSFER" <?php if($paymentMethod == Pageley_Commerce_Domain_PaymentMethod::$TRANSFER) { ?>selected="selected"<?php }?>><?php pc_echo(pc_message("order.paymentMethod.transfer")) ?></option>
            </select>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "paymentMethod"));
        ?>
        <span class="check">
            <input type="radio" id="order.sendInvoice.yes" name="sendInvoice" value="1" <?php if(pc_variable("sendInvoice")) { ?>checked="checked"<?php } ?>/>
            <label for=order.sendInvoice.yes><?php pc_echo(pc_message("order.sendInvoice.yes")); ?></label><br/>
            <input type="radio" id="order.sendInvoice.no" name="sendInvoice" value="0" <?php if(!pc_variable("sendInvoice")) { ?>checked="checked"<?php } ?>/>
            <label for="order.sendInvoice.no"><?php pc_echo(pc_message("order.sendInvoice.no")); ?></label>
        </span>
    </fieldset>
    <fieldset class="distinct">
        <legend><?php pc_echo(pc_message("order.delivery")); ?></legend>
        <span class="required">
            <label for="order.deliveryName"><?php pc_echo(pc_message("field.name")); ?></label>
            <input type="text" id="order.deliveryName" name="deliveryName" value="<?php pc_echo(pc_variable("deliveryName")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "deliveryName")); ?>
        <span class="required">
            <label for="order.deliveryAddress.line1"><?php pc_echo(pc_message("field.address.line1")); ?></label>
            <input type="text" id="order.deliveryAddress.line1" name="deliveryAddress.line1" value="<?php pc_echo(pc_variable("deliveryAddress.line1")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "deliveryAddress.line1")); ?>
        <label for="order.deliveryAddress.line2"><?php pc_echo(pc_message("field.address.line2")); ?></label>
        <input type="text" id="order.deliveryAddress.line2" name="deliveryAddress.line2" value="<?php pc_echo(pc_variable("deliveryAddress.line2")); ?>"/>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "deliveryAddress.line2")); ?>
        <span class="required">
            <label for="order.deliveryAddress.postalCode"><?php pc_echo(pc_message("field.address.postalCode")); ?></label>
            <input type="text" id="order.deliveryAddress.postalCode" name="deliveryAddress.postalCode" value="<?php pc_echo(pc_variable("deliveryAddress.postalCode")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "deliveryAddress.postalCode")); ?>
        <span class="required">
            <label for="order.deliveryAddress.city"><?php pc_echo(pc_message("field.address.city")); ?></label>
            <input type="text" id="order.deliveryAddress.city" name="deliveryAddress.city" value="<?php pc_echo(pc_variable("deliveryAddress.city")); ?>"/>
        </span>
        <?php pc_pagelet("basic/error", array(
            "errors" => $errors,
            "propertyName" => "deliveryAddress.city"));
            $sendInvoice = pc_variable("sendInvoice");
            if($sendInvoice === null) {
                $sendInvoice = true;
            }
        ?>
        <span>
            <label for="order.comment"><?php pc_echo(pc_message("field.comment")); ?></label>
            <textarea id="order.comment" name="comment" rows="6"><?php pc_echo(pc_variable("comment")); ?></textarea>
        </span>
    </fieldset>
    <div class="buttons">
        <input type="hidden" name="targetPage.location" value="<?php pc_echo(pc_variable("targetPage.location")); ?>"/>
        <button type="submit" name="controller" value="Commerce/Authenticated/AddInfoToOrder" class="continue"><?php pc_echo(pc_message("common.navigation.continue")); ?></button>
    </div>
</form>